package com.example.elasticsearchhepler.entity;

import com.example.elasticsearchhepler.annotations.ESDocument;
import com.example.elasticsearchhepler.annotations.ESField;
import com.example.elasticsearchhepler.entity.common.BaseEsEntity;
import com.example.elasticsearchhepler.enums.ESAnalyzerType;
import com.example.elasticsearchhepler.enums.ESFieldType;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.stereotype.Component;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ESDocument(indexName = "test_index_auto_00123")
@Component
public class TestIndexAutoEntity extends BaseEsEntity implements Serializable {

    private static final long serialVersionUID = -7298596379026894107L;
    @ESField(name = "user_name",type = ESFieldType.Keyword,searchAnalyzer = ESAnalyzerType.IK_MAX_WORD,analyzer=ESAnalyzerType.IK_MAX_WORD)
    private String userName;

    @ESField(name = "user_title",type = ESFieldType.Text,completion = true,searchAsYouType = true)
    private String userTitle;

    @ESField(name = "user_score",type = ESFieldType.Double)
    private double userScore;

    @ESField(name = "weight",type = ESFieldType.Float)
    private float weight;

    @ESField(name = "study_flag",type = ESFieldType.Boolean)
    private Boolean studyFlag;

    @ESField(name = "user_age",type = ESFieldType.Integer)
    private Integer userAge;

    @ESField(name = "run_distance",type = ESFieldType.Long)
    private Long runDistance;

    @ESField(name = "birth_date",type = ESFieldType.Date,format="yyyy-MM-dd'T'HH:mm:ss.SSS")
    private LocalDateTime birthDate;


//    @ESField(name = "num1",type = ESFieldType.Integer)
//    private Integer num1;
//
//    @ESField(name = "int_num2",type = ESFieldType.Integer)
//    private Integer num2;
//
//    @ESField(name = "keyword_str1")
//    private String str1;
//
//    @ESField(name = "text_str2")
//    private String str2;
//
//    @ESField(name = "dou1",type = ESFieldType.Double)
//    private double dou1;
//
//    @ESField(name = "double_dou2",type = ESFieldType.Double)
//    private double dou2;
//
//    @ESField(name = "ip_str")
//    private String ipStr;
//
//    @ESField(name = "date_1",type = ESFieldType.Date)
//    private LocalDateTime data1;
//
//    @ESField(name = "date_2",type = ESFieldType.Date)
//    private Date data2;
}
